<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
 	protected  function _initDb() //Thiet dat Zend_Registry::setDefaultAdapter() su dung cho zend Auth
	{
	
	$dbOption = $this->getOption('resources');
	$dbOption = $dbOption['db'];

	$db=Zend_Db::factory($dbOption['adapter'],$dbOption['params']);
	$db->setFetchMode(Zend_Db::FETCH_ASSOC);
	
	$db->query("SET NAMES 'UTF8'" );
	$db->query("SET CHARACTER SET 'UTF8'");
	Zend_Registry::set("connectDb",$db);
	Zend_Db_Table::setDefaultAdapter($db);
	}
	
	protected function _initSession()//Thiet dat Session o che do start
	{
		Zend_Session::start();
		
	}
	
	protected function _initFrontController()
	{
           $front = Zend_Controller_Front::getInstance();       
           $front->addModuleDirectory(APPLICATION_PATH."/modules/");	//Thiet dat duong dan dan folder 'modules'
           $front->setDefaultModule('default'); //Thiet dat ten Module lam default
          
           $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/routers.ini', 'thietlap');//Thiet dat cho file config,'thietlap' la ten phan doan cua router

           $router = new Zend_Controller_Router_Rewrite(); //Nhung cau lenh duoi day cau hinh router
           $router = $router->addConfig($config, 'routes');
		   $front->setRouter($router);
		   return $front;
    }

}